function doDelete(){
	if(window.confirm("是否确认删除?"))
		return true;
	else return false;
}

function batch_do(action){
    if (!atleaseOneCheck()){
            alert('请选择要删除对象!');
            return;
    }
    if (confirm("确定删除所选对象?")){
        var form = document.forms.ec;
        form.action = action + '&autoInc=false';
        form.submit();
    }
}

function atleaseOneCheck(){
    var items = document.getElementsByName('items');
    if (items.length > 0) {
        for (var i = 0; i < items.length; i++){
            if (items[i].checked == true){
                return true;
            }
        }
    } else {
        if (items.checked == true) {
            return true;
        }
    }
    return false;
}

function setAllCheckboxState(name,state) {
	var elms = document.getElementsByName(name);
	for(var i = 0; i < elms.length; i++) {
		elms[i].checked = state
	}
}

function reverseAllCheckboxState(name) {
	var elms = document.getElementsByName(name);
	for(var i = 0; i < elms.length; i++) {
		elms[i].checked = !elms[i].checked;
	}
}

function getReferenceForm(elm) {
	while(elm && elm.tagName != 'BODY') {
		if(elm.tagName == 'FORM') return elm;
		elm = elm.parentNode;
	}
	return null;
}

function getparmByUrl(parmName){
	 var url = window.location.toString();
	 var arr = url.split("?");
	 var parms = arr[1];
	 var parmList = parms.split("&");
	 var parmTemp;
	 for(var i=0;i<parmList.length;i++)
	 {
	  parmTemp = parmList[i].split("=");
	  if(parmTemp[0] == parmName)
	  return parmTemp[1];
	 }
	 return ""
}

function getRadioInputValue(name) {
	var result = null; 
	$A(document.getElementsByName(name)).each(function(elm){
		if(elm.checked) result = elm.value;
	});
	return result;
}

function buttonMouseOver(obj){
	var className = obj.className;
	if(className.indexOf("_mouseOver")==-1)
		obj.className = className+'_mouseOver';
	
}
function buttonMouseOut(obj){
	var className = obj.className;
	if(className.indexOf('_mouseOver')!=-1)
		obj.className = className.substring(0,className.indexOf('_mouseOver'));
}

function doQuery(pageNumber){
	var url = window.location.href+'';
	if(url.indexOf("?")==-1){
		window.location.href=url+'?pageNumber='+pageNumber;
	}else{
		if(url.indexOf("pageNumber")==-1)
			window.location.href=url+'&pageNumber='+pageNumber;
		else{
			var theUrl = url.substring(0,url.indexOf('pageNumber'));
			window.location.href=theUrl+'pageNumber='+pageNumber;
		}
	}
}

